package com.design.interpreter;

/**
 * @author leali
 * @title: SentenceNode
 * @projectName design
 * @description: 简单句子解释：非终结符表达式
 * @date 2022/1/3 18:16
 */
public class SentenceNode extends AbstractNode{
    private final AbstractNode direction;
    private final AbstractNode action;
    private final AbstractNode distance;

    public SentenceNode(AbstractNode direction,AbstractNode action,AbstractNode distance) {
        this.direction = direction;
        this.action = action;
        this.distance = distance;
    }
    @Override
    public String interpret() {
        return direction.interpret() + action.interpret() + distance.interpret();
    }
}
